import { PORT1 } from "../config/servicePort";
import Http from "@/api/index";
import { ArticleBase } from "../interface/article";

export const createGroup = (params: any) => {
  return Http.post(PORT1 + "/system/article/group/add", params);
};

export const editGroup = (params: any) => {
  return Http.put(PORT1 + "/system/article/group/edit", params);
};

export const getGroups = () => {
  return Http.get(PORT1 + "/system/article/group/list");
};

export const createArticle = (params: ArticleBase.Option) => {
  return Http.post(PORT1 + "/system/article/add", params);
};

export const editArticle = (params: ArticleBase.Option) => {
  return Http.put(PORT1 + "/system/article/edit", params);
};

export const getList = (params: any) => {
  return Http.post(PORT1 + "/system/article/list", params);
};

export const getArticle = (id: number) => {
  return Http.get(PORT1 + "/system/article/detail", { id });
};

export const deleteArt = (params: any) => {
  return Http.post(PORT1 + "/system/article/delete", params);
};

export const deleteGroup = (params: any) => {
  return Http.post(PORT1 + "/system/article/group/delete", params);
};
